///自定义响应封装
class BaseResponse<T> {
  //状态码
  final dynamic code;
  final dynamic status;

  //状态描述
  final String msg;
  final String message;

  //数据
  final T data;

  BaseResponse({this.code, this.status, this.msg, this.message, this.data});

  BaseResponse.fromJson(Map<dynamic, dynamic> json)
      : code = json['code'] as dynamic,
        status = json['status'] as int,
        msg = json['msg'] as String,
        message = json['message'] as String,
        data = json['data'];

  @override
  String toString() {
    StringBuffer buffer = StringBuffer();
    buffer.write('{');
    buffer.write('"code":$code');
    buffer.write('"status":$status');
    buffer.write('"msg":"$msg"');
    buffer.write('"message":"$message"');
    buffer.write('"data":"$data"');
    buffer.write('}');
    return super.toString();
  }
}
